package com.yl.pattern.structuralmodel.combination;

/**
 * @Author 小羊
 * @Date 31/10/2024下午 2:18
 * @ClassName MenuItem
 * @Description 菜单项类（叶子结点）
 */
public class MenuItem extends MenuComponent{
    public MenuItem(String name,int level) {
        this.name = name;
        this.level = level;
    }

    @Override
    public void print() {
        for (int i=0;i<level;i++){
            System.out.print(" ");
        }
        //打印菜单项的名称
        System.out.println(name);
    }
}
